package com.boot.controller;

import com.boot.bean.UserDo;
import com.boot.enums.ResultEnum;
import com.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * 页面跳转
 */
@Controller
public class PageController {
    @Autowired
    private UserService userService;
    /**
     * 跳转到画布页面
     */
    @RequestMapping("/canvasPage")
    public String web(Long id, HttpSession session) {
        UserDo attribute = (UserDo) session.getAttribute(ResultEnum.USERKEY.getMessage());
        attribute.setRoomId(id);
        userService.save(attribute);
         return "html/canvasPage";
    }


    @RequestMapping(value = {"/loginPage", "/"})
    public String login() {
        return "html/loginPage";
    }

    @RequestMapping("/lobbyPage")
    public String lobbyPage() {
        return "html/lobbyPage";
    }


    @RequestMapping("/roomPage")
    public String roomPage() {
        return "html/roomPage";
    }
}
